Namespace Data

  ''' <summary>
  ''' Various data lists.
  ''' </summary>
  ''' <remarks></remarks>
  Public NotInheritable Class DataLists

    ''' <summary>
    ''' Retrieves a read-only list of <see cref="UsStateCollection">States</see>.
    ''' </summary>
    ''' <returns>List of <see cref="UsStateCollection">States</see>.</returns>
    ''' <remarks></remarks>
    Public Shared Function StatesList() As UsStateCollection

      Dim statesXml As New System.Xml.XmlDocument
      statesXml.LoadXml(My.Resources.StatesXML)

      Dim list As New System.Collections.Generic.List(Of State)

      For Each state As System.Xml.XmlNode In statesXml.SelectNodes("//state")

        Dim tempState As New State

        tempState.Name = state.Attributes("name").Value.ToString
        tempState.Code = state.Attributes("abbreviation").Value.ToString

        list.Add(tempState)

      Next

      Return New UsStateCollection(list)

    End Function

    ''' <summary>
    ''' Returns the ISO standard read-only list of <see cref="CountryCollection">Countries</see>.
    ''' </summary>
    ''' <returns>List of <see cref="CountryCollection">Countries</see>.</returns>
    ''' <remarks></remarks>
    Public Shared Function CountriesList() As CountryCollection

      Dim countriesXml As New System.Xml.XmlDocument
      countriesXml.LoadXml(My.Resources.CountriesXML)

      Dim list As New System.Collections.Generic.List(Of Country)

      For Each country As System.Xml.XmlNode In countriesXml.SelectNodes("//ISO_3166-1_Entry")

        Dim tempCountry As New Country

        tempCountry.Name = country.SelectSingleNode("ISO_3166-1_Country_name").InnerText
        tempCountry.Code = country.SelectSingleNode("ISO_3166-1_Alpha-2_Code_element").InnerText

        list.Add(tempCountry)

      Next

      Return New CountryCollection(list)

    End Function

    Private Sub New()
    End Sub

  End Class

End Namespace